Skip to content

Conversation

CrosRoad95
Copy link

@CrosRoad95 CrosRoad95 commented Dec 17, 2018

Idea of this pr is lets user edit collision.
If you wanna edit collision, load it via engineLoadCOL, original collision you can read by model id, but are read-only.

Examples:
https://www.youtube.com/watch?v=MtlTJ3GxQ-M
https://www.youtube.com/watch?v=_QV2FkASLas
https://www.youtube.com/watch?v=wCCijVBLPjU
https://www.youtube.com/watch?v=m6gVWZVVj3E
https://www.youtube.com/watch?v=Rt82oFuJ-dM

Test resource:
test.zip

Functions

table engineGetModelCollisionProperties( col theCol / int modelID)
table engineGetModelCollisionData( col theCol / int modelID, collision-shape [, int index ] )
bool,table engineSetModelCollisionData( col theCol, collision-shape, collision-key, int shapeID / table shapeID, mixed value )
bool engineUpdateModelCollisionBoundingBox( col theCol [, float x, float y, float z ] )
bool isModelCollisionLoaded( int modelID )

engineGetModelCollisionProperties

Return table with information about loaded .col file or modelID ( if collision is loadeded )

  • boundingBox
    • vecMin {x,y,z} - minimal position of collision
    • vecMax {x,y,z} - maximal position of collision
    • vecOffset {x,y,z} - offset of sphere
    • radius float - radius of bounding sphere
  • colBoxes int - number of boxes that collision has
  • colSpheres int - number of spheres that collision has
  • colTriangles int - number of triangles that collision has
  • colVertices int - number of vertices that collision has

isModelCollisionLoaded

Checks whether original collision is loaded and can be read.

engineSetModelCollisionData

Changing collision, returns boolean if success, and false if something wrong, second argument returns all wrong triangles, vertices etc.

engineUpdateModelCollisionBoundingBox

Updates collision bounding box, need to be used if

  • Collision shape was move outside current bounding box, otherwise your collision had issues with detection peds, vehicles, other elements collisions
  • If you moved collision shape and now bounding box is too big, otherwise gta will needlessly check collision, what unnecessary consume cpu.

Enums

collision-shape: vertex box triangle sphere
collision-key: size material position radius lighting vertices move
vertex arg1 arg2 arg3 description Restrictions
position float float float Changs a position of vertex. abs( position ) <= 128
move float float float Adds a position to a current position. abs( position + move ) <= 128
triangle arg1 arg2 arg3 description Restrictions
material int Changes a material of surface. 0 - 178
lighting int day int night Changes a lighting of triangle. 0 - 15
sphere arg1 arg2 arg3 Description Restrictions
position float float float Changs a position of vertex. abs( position + radius ) <= 128
move float float float Adds a position to a current position. abs( position + move + radius ) <= 128
radius float Changes radius of sphere radius > 0, radius <= 256
material int Changes material of surface. 0 - 178
box arg1 arg2 arg3 arg4 arg5 arg6 Description Restrictions
material int Changes material of surface. 0 - 178
position float float float Changes position of box. abs( position + (maxSize - minSize) / 2 ) <= 128
size boolean float float float Changes size, argument1 == true for min size, false = max size abs( position ) <= 128, max size >= min size
size float float float float float float Changes min and max size. max size >= min size

CrosRoad95 added 30 commits May 30, 2018 21:55
for now, a bit unstable
only boxes for now
@CrosRoad95
Copy link
Author

@qaisjp would you mind to fix enum class issue for me? i have no f**king clue make it

@CrosRoad95
Copy link
Author

anyone would fix enums for me?

@Pirulax
Copy link
Contributor

Pirulax commented Nov 27, 2020

The problem with enums is because of some circular include.
If the problem is in a TU (that is, .cpp file), then you may have forward declared the enum somewhere, but you haven't defined it(that is, you haven't included the header where the enum is).
Also, keep in mind that intellisense isn't perfect, it might very well be that the enum isn't even defined nor declared at all in that TU (.cpp file), but the intellisense is showing as if it was.

@qaisjp qaisjp removed this from the Confirmed Issues milestone Dec 7, 2020
@patrikjuvonen patrikjuvonen marked this pull request as draft August 4, 2021 20:13
@github-actions github-actions bot added the stale Inactive for over 90 days, to be closed label Jan 7, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Jan 7, 2022

This draft pull request is stale because it has been open for at least 90 days with no activity. Please continue on your draft pull request or it will be closed in 30 days automatically.

@github-actions github-actions bot closed this Feb 7, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Feb 7, 2022

This draft pull request was closed because it has been marked stale for 30 days with no activity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request stale Inactive for over 90 days, to be closed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants